import React, { Component } from "react";

export default class list extends Component {
    render() {
        const { data, deletei } = this.props;
        return (
            <div>
                <p>正在进行的条数:{data.length}</p>
                <ul>
                    {data.map((item, index) => {
                        return (
                            <li>
                                <input type="checkbox" />
                                {item}------------------------------
                                <button onClick={() => deletei(index)}>
                                    删除
                                </button>
                            </li>
                        );
                    })}
                </ul>
            </div>
        );
    }
}
// 第二种写法:
/* const List = (props) => {
    const { data, deletei } = props;
    return (
        <div>
            <p>正在进行的条数:{data.length}</p>
            <ul>
                {data.map((item, index) => {
                    return (
                        <li>
                            <input type="checkbox" />
                            {item}------------------------------
                            <button onClick={() => deletei(index)}>删除</button>
                        </li>
                    );
                })}
            </ul>
        </div>
    );
};

export default List; */
